import request from '@/utils/request'

// 查询用户列表
export function listData(query) {
  return request({
    url: '/sys/user/',
    method: 'get',
    params: query
  })
}


//查询全部用户
export function getAllUser(type) {
    return request({
      url: '/sys/user/refer?type='+type,
      method: 'get'
    })
}
//仓库管理员
export function manageList(type) {
    return request({
      url: '/basic/warehouse/manager/refer',
      method: 'get'
    })
}

// 查询用户详细
export function getDetail(id) {
  return request({
    url: '/sys/user/' + id,
    method: 'get'
  })
}

// 新增用户
export function addData(data) {
  return request({
    url: '/sys/user/',
    method: 'post',
    data: data
  })
}

// 修改用户
export function updateData(data) {
  return request({
    url: '/sys/user/',
    method: 'put',
    data: data
  })
}

// 冻结/解冻用户
export function delData(data) {
  return request({
    url: '/sys/user/enable',
    method: 'put',
    data: data
  })
}

// 修改密码
export function updatePwd(query,content) {
  return request({
    url: '/sys/user/updatePasswordByPrimaryKey',
    method: 'post',
    params: query,
    content:content
  })
}

// 登录
export function login(query,content) {
  return request({
    url: '/sys/user/toLogin',
    method: 'post',
    data: query,
    content:content
  })
}

// 退出
export function clearData() {
  return request({
    url: '/sys/user/logout',
    method: 'post',
  })
}

// 查询用户列表
export function createQrcode(query) {
  return request({
    url: '/sys/user/createUserQRCode',
    method: 'get',
    params: query
  })
}

export function unbindApplet(query) {
  return request({
    url: '/sys/user/unbindApplet',
    method: 'get',
    params: query
  })
}

// 获取销售列表
export function refereeList() {
  return request({
    url: '/sys/user/referee',
    method: 'get',
  })
}

//删除系统管理员

export function deleteUser(id) {
  return request({
    url: '/sys/user/' + id,
    method: 'delete',
  })
}
